# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pound
pkgver=4.13
pkgrel=0
pkgdesc="A reverse proxy, load balancer, and SSL wrapper"
url="https://github.com/graygnuorg/pound"
arch="all"
license="GPL-3.0-or-later"
makedepends="pcre2-dev openssl-dev"
checkdepends="perl"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://github.com/graygnuorg/pound/releases/download/v$pkgver/pound-$pkgver.tar.gz
	pound.cfg
	$pkgname.initd
	$pkgname.confd
	"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/pound \
		--localstatedir=/var \
		--with-owner=root \
		--with-group=root
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/pound.initd "$pkgdir"/etc/init.d/pound
	install -Dm755 "$srcdir"/pound.confd "$pkgdir"/etc/conf.d/pound
	install -Dm644 "$srcdir"/pound.cfg "$pkgdir"/etc/pound/pound.cfg
}

sha512sums="
0a9f8612c4f894abcaac569d8f673cd39ea8cab21e2dfcd2968f1f79796a5c15af7d3e7fdae9b0e9dfe86f40c90bd466d20db85500dc05975aa6d65108cf26a1  pound-4.13.tar.gz
9471e5abe3e0ee83165ed01a7081a4d14075c6c21b9f9d7c3fb239aa78c38eae74394a7c7e7e7753d218a7ce5cae388823570d19b702a829baa93e949a8946b8  pound.cfg
4c89ccfee07b0dcbd5c8341b2711c69cc67b13a50f21bd9b1fa8b0355dd4928461a941fc9085d93d85cfc0aaa514059a7eef8a203e57b5a20a7de498dd099bf8  pound.initd
29149d2fa2c161ecb47f8189a6be86ae85d6da2b7cf04258ce41c4e710144296b6a7642d4341c3c62eb98745dcc5d855df36451d2db069e71584045d36e09dfe  pound.confd
"
